package com.xbao.dao;

import com.xbao.model.GuideDoc;
import com.xbao.model.GuideDocExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface GuideDocMapper {
    @SelectProvider(type=GuideDocSqlProvider.class, method="countByExample")
    int countByExample(GuideDocExample example);

    @DeleteProvider(type=GuideDocSqlProvider.class, method="deleteByExample")
    int deleteByExample(GuideDocExample example);

    @Delete({
        "delete from guide_doc",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into guide_doc (guide, createtime, ",
        "updatetime, content)",
        "values (#{guide,jdbcType=VARCHAR}, #{createtime,jdbcType=BIGINT}, ",
        "#{updatetime,jdbcType=BIGINT}, #{content,jdbcType=LONGVARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(GuideDoc record);

    @InsertProvider(type=GuideDocSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insertSelective(GuideDoc record);

    @SelectProvider(type=GuideDocSqlProvider.class, method="selectByExampleWithBLOBs")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="guide", property="guide", jdbcType=JdbcType.VARCHAR),
        @Result(column="createtime", property="createtime", jdbcType=JdbcType.BIGINT),
        @Result(column="updatetime", property="updatetime", jdbcType=JdbcType.BIGINT),
        @Result(column="content", property="content", jdbcType=JdbcType.LONGVARCHAR)
    })
    List<GuideDoc> selectByExampleWithBLOBs(GuideDocExample example);

    @SelectProvider(type=GuideDocSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="guide", property="guide", jdbcType=JdbcType.VARCHAR),
        @Result(column="createtime", property="createtime", jdbcType=JdbcType.BIGINT),
        @Result(column="updatetime", property="updatetime", jdbcType=JdbcType.BIGINT)
    })
    List<GuideDoc> selectByExample(GuideDocExample example);

    @Select({
        "select",
        "id, guide, createtime, updatetime, content",
        "from guide_doc",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="guide", property="guide", jdbcType=JdbcType.VARCHAR),
        @Result(column="createtime", property="createtime", jdbcType=JdbcType.BIGINT),
        @Result(column="updatetime", property="updatetime", jdbcType=JdbcType.BIGINT),
        @Result(column="content", property="content", jdbcType=JdbcType.LONGVARCHAR)
    })
    GuideDoc selectByPrimaryKey(Long id);

    @UpdateProvider(type=GuideDocSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") GuideDoc record, @Param("example") GuideDocExample example);

    @UpdateProvider(type=GuideDocSqlProvider.class, method="updateByExampleWithBLOBs")
    int updateByExampleWithBLOBs(@Param("record") GuideDoc record, @Param("example") GuideDocExample example);

    @UpdateProvider(type=GuideDocSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") GuideDoc record, @Param("example") GuideDocExample example);

    @UpdateProvider(type=GuideDocSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(GuideDoc record);

    @Update({
        "update guide_doc",
        "set guide = #{guide,jdbcType=VARCHAR},",
          "createtime = #{createtime,jdbcType=BIGINT},",
          "updatetime = #{updatetime,jdbcType=BIGINT},",
          "content = #{content,jdbcType=LONGVARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKeyWithBLOBs(GuideDoc record);

    @Update({
        "update guide_doc",
        "set guide = #{guide,jdbcType=VARCHAR},",
          "createtime = #{createtime,jdbcType=BIGINT},",
          "updatetime = #{updatetime,jdbcType=BIGINT}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(GuideDoc record);
}